home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2543 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  838 b 

  1. Path: news.clark.net!not-for-mail
  2. From: gusty@clark.net (Harlan Messinger)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: overloading []
  5. Date: 17 Jan 1996 21:32:22 GMT
  6. Organization: Clark Internet Services, Inc., Ellicott City, MD USA
  7. Message-ID: <4djpt6$p02@clarknet.clark.net>
  8. References: <4dgjbl$6i3@news1.goodnet.com> <4dh86s$bfi@locutus.rchland.ibm.com>
  9. NNTP-Posting-Host: explorer.clark.net
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
  14.  
  15. pstaite@vnet.ibm.com wrote:
  16. : No, you could do:
  17. : (*f)[ 1 ] = 10;
  18. : or what I would do:
  19. : foo& f( *new foo );
  20. : f[ 1 ] = 10;
  21. : // later on:
  22. : delete &f;
  23.  
  24. Why would you do
  25.  
  26.     foo& f(* new foo);
  27.  
  28. followed by a delete instead of just
  29.  
  30.     foo f;
  31.  
  32. with f disappearing when it goes out of scope?
  33.  
  34.